package com.dangdang.model;

import com.dangdang.util.StringUtil;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class CouponInfo implements Serializable {

    /**
     * <code>serialVersionUID</code> 的注释
     */
    private static final long serialVersionUID = 7868937468718827254L;

    private String couponNum;
    /**
     * 拥有者ID
     */

    private int custId;
    /**
     * 批次号
     */
    @JsonProperty("apply_id")
    private int applyId;
    /**
     * 商家ID
     */
    @JsonProperty("shop_id")
    private int shopId = 0;

    /**
     * 主类型
     */
    @JsonProperty("type")
    private int type;
    /**
     * 分类型
     */
    @JsonProperty("medium_scope_id")
    private int mediumScopeId;

    /**
     * 是否是叠加券   1 是，0 否
     */
    @JsonProperty("canAddUp")
    private int canAddUp;




    private List<Integer> count =  new ArrayList<>();


    public List<Integer> getCount() {
        return count;
    }

    public void setCount(List<Integer> count) {
        this.count = count;
    }

    public boolean isLimitTime() {
        return limitTime;
    }

    public void setLimitTime(boolean limitTime) {
        this.limitTime = limitTime;
    }

    private boolean limitTime;

    public int getLeftSecond() {
        return leftSecond;
    }

    public void setLeftSecond(int leftSecond) {
        this.leftSecond = leftSecond;
    }

    private int leftSecond;

    private boolean isNewCust;

    private String disabledReason;

    public boolean isNewCust() {
        return isNewCust;
    }

    public void setNewCust(boolean newCust) {
        isNewCust = newCust;
    }

    public String getDisabledReason() {
        return disabledReason;
    }

    public void setDisabledReason(String disabledReason) {
        this.disabledReason = disabledReason;
    }

    /**
     * 支持的平台support_platform : 0 支持自营 1支持商家 2支持商家和自营,-1未设置
     */
    @JsonProperty("support_platform")
    private int supportPlatform;
    /**
     * 优惠券面额
     */
    @JsonProperty("face_value")
    private Money faceValue;

    /**
     * 优惠券剩余金额
     */
    @JsonProperty("money")
    private Money money;

    private double money4m;

    /**
     * 开始日期
     */
    @JsonProperty("start_date")
    //@JsonDeserialize(using = JsonWithNamingStatagyUtil.DateDeserialize.class)
    private String startDate;
    /**
     * 结束日期
     */
    @JsonProperty("end_date")
    //@JsonDeserialize(using = JsonWithNamingStatagyUtil.DateDeserialize.class)
    private String endDate;
    /**
     * 说明
     */
    @JsonProperty("memo")
    private String memo;
    /**
     * 礼券使用范围说明
     */
    @JsonProperty("remark")
    private String remark;
    /**
     * 最小使用金额
     */
    private Money minPrice;

    private double minPrice4m;
    /**
     * 是否有例外品
     */
    @JsonProperty("has_exception_product")
    private boolean hasExceptionProduct;

    /**
     * 礼券连接地址
     */
    @JsonProperty("coupon_url")
    private String couponUrl;

    /**
     * 使用平台
     */
    @JsonProperty("use_platform")
    private int usePlatform;

    /**
     * 当前是否有效
     */
    @JsonProperty("is_current_valid")
    private boolean isCurrentValid = true;

    /**
     * 当前礼券可用于的订单集合
     */
    @JsonProperty("valid_for_order")
    private String validForOrder;

    // order_ids:0_0|is_cross_order:0
    @JsonProperty("orderIds")
    private String orderIds;

    @JsonProperty("isCrossOrder")
    private String isCrossOrder;


    @JsonProperty("shop_name")
    private String shopName;
    
    private String useConditions;

    /**
     * 该礼券支持的指定商家名称
     */
    private String surportSpecificShopNames;

    /**
     * 该礼券支持的平台号
     */
    private  List<Integer> surportPlatformIds;

    /**
     * 商品不是指定分类
     */
    private boolean categoryNotFit = false;

    /**
     * 不是指定商品
     */
    private boolean specificProductNotFit = false;

    /**
     * 商品为例外品
     */
    private List<Long> exceptionProductIds;

    /**
     * 礼券与最低使用金额的差值，礼券不可用时才赋值
     */
    private Money gapAmount;





    /**
     *
     * 礼券支持的介质类型，仅当该礼券不可用时有值
     */
    private String mediumSupported;



    @JsonProperty("product_app_url")
    private String productAppUrl;


    @JsonProperty("time_tips")
    private String timeTips;

    /**
     * 满件折礼券 差多少件可用
     */
    private int gapCount;

    /**
     * 申请金额类型:
     *  0 按单张固定面值
     *  1 按总金额(客服补发)
     *  2 满额折
     *  3 满件折
     *  4 滴滴零元购
     */
    private int couponApplyMoneyType;

    /**
     * 满件折时的最小件数
     * couponApplyMoneyType=3时，这个值必有，代表满件折时的最小件数
     */
    private int minDiscountNumber;

    /**
     * 折扣礼券的优惠上限
     * couponApplyMoneyType=2或者3时必有，代表折扣礼券的优惠上限
     */
    private Money discountLimit;

    private Money usableMoney=new Money(0);

    /**
     * 是否新客券
     */
    private boolean isNewCustCoupon;

    /**
     * 新客券不可用原因
     */
    private String newCustCouponReason;

    /**
     * 满xx可以
     */
    private String couponThreshold;

    /**
     * 是否wenhui券
     */
    private boolean wenhui;

    public String getCouponThreshold() {
        return couponThreshold;
    }

    public void setCouponThreshold(String couponThreshold) {
        this.couponThreshold = couponThreshold;
    }

    public boolean isNewCustCoupon() {
        return isNewCustCoupon;
    }

    public void setNewCustCoupon(boolean newCustCoupon) {
        isNewCustCoupon = newCustCoupon;
    }

    public String getNewCustCouponReason() {
        return newCustCouponReason;
    }

    public void setNewCustCouponReason(String newCustCouponReason) {
        this.newCustCouponReason = newCustCouponReason;
    }

    public Money getUsableMoney() {
        return usableMoney;
    }

    public void setUsableMoney(Money usableMoney) {
        this.usableMoney = usableMoney;
    }

    public Money getDiscountLimit() {
        return discountLimit;
    }

    public void setDiscountLimit(Money discountLimit) {
        this.discountLimit = discountLimit;
    }

    public int getMinDiscountNumber() {
        return minDiscountNumber;
    }

    public void setMinDiscountNumber(int minDiscountNumber) {
        this.minDiscountNumber = minDiscountNumber;
    }

    public int getCouponApplyMoneyType() {
        return couponApplyMoneyType;
    }

    public void setCouponApplyMoneyType(int couponApplyMoneyType) {
        this.couponApplyMoneyType = couponApplyMoneyType;
    }

    public int getGapCount() {
        return gapCount;
    }

    public void setGapCount(int gapCount) {
        this.gapCount = gapCount;
    }


    public String getMediumSupported() {
        return mediumSupported;
    }

    public void setMediumSupported(String mediumSupported) {
        this.mediumSupported = mediumSupported;
    }
    public Money getGapAmount() {
        return gapAmount;
    }

    public void setGapAmount(Money gapAmount) {
        this.gapAmount = gapAmount;
    }

    public boolean isCategoryNotFit() {
        return categoryNotFit;
    }

    public void setCategoryNotFit(boolean categoryNotFit) {
        this.categoryNotFit = categoryNotFit;
    }

    public boolean isSpecificProductNotFit() {
        return specificProductNotFit;
    }

    public void setSpecificProductNotFit(boolean specificProductNotFit) {
        this.specificProductNotFit = specificProductNotFit;
    }

    public List<Long> getExceptionProductIds() {
        return exceptionProductIds;
    }

    public void setExceptionProductIds(List<Long> exceptionProductIds) {
        this.exceptionProductIds = exceptionProductIds;
    }

    public String getSurportSpecificShopNames() {
        return surportSpecificShopNames;
    }

    public void setSurportSpecificShopNames(String surportSpecificShopNames) {
        this.surportSpecificShopNames = surportSpecificShopNames;
    }

    public List<Integer> getSurportPlatformIds() {
        return surportPlatformIds;
    }

    public void setSurportPlatformIds(List<Integer> surportPlatformIds) {
        this.surportPlatformIds = surportPlatformIds;
    }

    public String getUseConditions() {
        return useConditions;
    }

    public void setUseConditions(String useConditions) {
        this.useConditions = useConditions;
    }

    private int usedForAllOrders;//是否全场通用 type=0&medium_scope_id=6 全场通用，包含商家和自营

    public String getCouponNum() {
        return couponNum;
    }

    public void setCouponNum(String couponNum) {
        this.couponNum = couponNum;
    }

    public int getCustId() {
        return custId;
    }

    public void setCustId(int custId) {
        this.custId = custId;
    }

    public int getApplyId() {
        return applyId;
    }

    public void setApplyId(int applyId) {
        this.applyId = applyId;
    }

    public int getShopId() {
        return shopId;
    }

    public void setShopId(int shopId) {
        this.shopId = shopId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getMediumScopeId() {
        return mediumScopeId;
    }

    public void setMediumScopeId(int mediumScopeId) {
        this.mediumScopeId = mediumScopeId;
    }

    /**
     * 支持的平台support_platform : 0 支持自营 1支持商家 2支持商家和自营,-1未设置
     * 
     * @return
     */
    public int getSupportPlatform() {
        return supportPlatform;
    }

    public void setSupportPlatform(int supportPlatform) {
        this.supportPlatform = supportPlatform;
    }

    public Money getFaceValue() {
        return faceValue;
    }

    public void setFaceValue(Money faceValue) {
        this.faceValue = faceValue;
    }

    public Money getMoney() {
        return money;
    }

    public void setMoney(Money money) {
        this.money = money;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

    public Money getMinPrice() {
        return minPrice;
    }

    public void setMinPrice(Money minPrice) {
        this.minPrice = minPrice;
    }

    public boolean isHasExceptionProduct() {
        return hasExceptionProduct;
    }

    public void setHasExceptionProduct(boolean hasExceptionProduct) {
        this.hasExceptionProduct = hasExceptionProduct;
    }

    public String getCouponUrl() {
        return couponUrl;
    }

    public void setCouponUrl(String couponUrl) {
        this.couponUrl = couponUrl;
    }

    public int getUsePlatform() {
        return usePlatform;
    }

    public void setUsePlatform(int usePlatform) {
        this.usePlatform = usePlatform;
    }

    public boolean isCurrentValid() {
        return isCurrentValid;
    }

    public void setCurrentValid(boolean isCurrentValid) {
        this.isCurrentValid = isCurrentValid;
    }

    public String getValidForOrder() {
        if (StringUtil.isEmpty(validForOrder)) {
            validForOrder = "";
        }
        return validForOrder;
    }

    public void setValidForOrder(String validForOrder) {
        this.validForOrder = validForOrder;
    }


    public double getMoney4m() {
        if (money != null) {
            money4m = Double.valueOf(money.toString()).doubleValue();
        } else {
            money4m = 0;
        }
        return money4m;
    }

    public void setMoney4m(double money4m) {
        this.money4m = money4m;
    }

    public double getMinPrice4m() {
        if (minPrice != null) {
            minPrice4m = Double.valueOf(minPrice.toString()).doubleValue();
        } else {
            minPrice4m = 0;
        }
        return minPrice4m;
    }

    public void setMinPrice4m(double minPrice4m) {
        this.minPrice4m = minPrice4m;
    }



    public String getOrderIds() {
        return orderIds;
    }

    public void setOrderIds(String orderIds) {
        this.orderIds = orderIds;
    }

    public String getIsCrossOrder() {
        return isCrossOrder;
    }

    public void setIsCrossOrder(String isCrossOrder) {
        this.isCrossOrder = isCrossOrder;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public int getUsedForAllOrders() {
        return usedForAllOrders;
    }

    public void setUsedForAllOrders(int usedForAllOrders) {
        this.usedForAllOrders = usedForAllOrders;
    }


    public String getProductAppUrl() {
        return productAppUrl;
    }

    public void setProductAppUrl(String productAppUrl) {
        this.productAppUrl = productAppUrl;
    }


    public String getTimeTips() {
        return timeTips;
    }

    public void setTimeTips(String timeTips) {
        this.timeTips = timeTips;
    }


    public boolean isWenhui() {
        return wenhui;
    }

    public void setWenhui(boolean wenhui) {
        this.wenhui = wenhui;
    }


    public int getCanAddUp() {
        return canAddUp;
    }

    public void setCanAddUp(int canAddUp) {
        this.canAddUp = canAddUp;
    }

}
